# Maintainer: Edmund Lodewijks <e.lodewijks at gmail. com>
# Contributor: Christian Hesse <mail@eworm.de>

pkgname=gtkglext
pkgver=1.2.0
_pkgvershort='1.2'
pkgrel=22
pkgdesc='An OpenGL extension to GTK2.'
arch=('x86_64')
url='https://sourceforge.net/projects/gtkglext/'
url='https://gitlab.gnome.org/Archive/gtkglext'
license=('LGPL-2.0-or-later')
depends=('glib2' 'pango' 'gtk2' 'glu' 'libxmu' 'libgl')
makedepends=('glib2-devel')
# The SourceForge source is used by some distro's. Others use gnome.
#source=("https://sourceforge.net/projects/${pkgname}/files/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2"
source=("https://download.gnome.org/sources/gtkglext/${_pkgvershort}/${pkgname}-${pkgver}.tar.bz2"
	'001-no-pangox.patch'
	'002-fix-gtk2.20-deprecated-symbols.patch'
	'003-gtkglext-gcc8.patch'
	'004-fix-gdk-gdkglshapes.c.patch')
sha256sums=('16bd736074f6b14180f206b7e91263fc721b49912ea3258ab5f094cfa5497f51'
            '8ce31aa17ea84aede3b03fa392ec95e0e9c001f348384ba93d850de9f0b7044e'
            '864c6963c4a2f4f69f1f028ecee6c821a4f4d5aba142f2e07898aede825ce9ea'
            '0ec0c22b15054b0684f9a9015ff05920af0c00dae5409e76321f683dcc17cff9'
            '499c49347df977f1d801eed5df0fd6398c1b1493c8a36d6d61bb6a7775eb83db')

prepare() {
  cd $pkgname-$pkgver

  patch -Np1 < ../001-no-pangox.patch
  patch -Np1 < ../002-fix-gtk2.20-deprecated-symbols.patch
  patch -Np1 < ../003-gtkglext-gcc8.patch
  patch -Np1 < ../004-fix-gdk-gdkglshapes.c.patch

  mv configure.{in,ac}
  sed '/AC_PATH_XTRA/d' -i configure.ac
  autoreconf -vi
}
  
build() {
  cd ${pkgname}-${pkgver}

  ./configure \
    --prefix=/usr \
    --disable-static
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
